<?php
class PNProjectArray extends PNObjectExArray {
  function PNProjectArray($init=null, $where='')
  {
    $this->PNObject();

    $this->_objType       = 'votedatacenter_project';
    $this->_objField      = 'id';
    $this->_objPath       = 'form';

    $this->_objJoin[]     = array ( 'join_table'  =>  'votedatacenter_province',
                            'join_field'          =>  array('name'),
                            'object_field_name'   =>  array('pro_name'),
                            'compare_field_table' =>  'pro_id',
                            'compare_field_join'  =>  'id');

    $this->_objJoin[]     = array ( 'join_table'  =>  'votedatacenter_district',
                            'join_field'          =>  array('name'),
                            'object_field_name'   =>  array('dis_name'),
                            'compare_field_table' =>  'dis_id',
                            'compare_field_join'  =>  'id');

    $this->_objJoin[]     = array ( 'join_table'  =>  'votedatacenter_tambon',
                            'join_field'          =>  array('name'),
                            'object_field_name'   =>  array('tam_name'),
                            'compare_field_table' =>  'tam_id',
                            'compare_field_join'  =>  'id');

    $this->_objJoin[]     = array ( 'join_table'  =>  'users',
                            'join_field'          =>  array('uname'),
                            'object_field_name'   =>  array('uname'),
                            'compare_field_table' =>  'cr_uid',
                            'compare_field_join'  =>  'uid');

    $this->_init($init, $where);
  }

  function genSort(){

    return " ORDER BY pro_id ASC";
    //return " ORDER BY pro_longitude DESC";
  }
}
